<template>
	<view>
		<uni-notification-center ref="unc"></uni-notification-center>
		<uni-notification-config></uni-notification-config>
	</view>
</template>

<script>
	import uncUtils from '@/uni_modules/uni-notification-center/utils/main.js';
	export default {
		data() {
			return {
				unreadCount: ''
			}
		},
		onReachBottom() {
			this.$refs.unc.loadData()
			// console.log('onReachBottom');
		},
		onPullDownRefresh() {
			// console.log('onPullDownRefresh');
			this.$refs.unc.refresh(()=>{
				uni.stopPullDownRefresh()
			})
		},
		onNavigationBarButtonTap() {
			this.$refs.unc.clearAllUnRead()
		},
		async onLoad() {
			uncUtils.bindUnreadCount(unreadCount => {
				this.unreadCount = unreadCount
				if(unreadCount){
					uni.setTabBarBadge({
						index:1,
						text:unreadCount.toString()
					})
				}else{
					uni.removeTabBarBadge({index:1})
				}
			})
		},
		methods: {
		}
	}
</script>

<style>

</style>
